clear
cd "data directory here" 
use expendituredata.dta

egen ind = group(head_ind)
gen pos_debt = 0 
replace pos_debt = 1 if total_debt > 0
gen pos_bank_debt = 0 
replace pos_bank_debt = 1 if bank_debt > 0
gen bank_share = bank_debt/total_debt
gen moneylender_debt = (nonbank_debt+personal_debt)
gen moneylender_share = moneylender_debt/total_debt
gen interest_rate = interest_pay/total_debt 
sum interest_rate if interest_rate > 0,d  
sum interest_rate ,d 
drop if interest_rate < .0017095 
drop if interest_rate >      .12 
sum interest_rate if interest_rate > 0,d 

gen ln_debt = ln(total_debt)
gen ln_bank = ln(bank_debt)
gen ln_interest = ln(interest_rate)
sum ln_interest if interest_rate > 0,d 
replace interest_rate = interest_rate*100

sum pos_bank_debt ,d 
sum pos_bank_debt if head_male == 0,d 
sum bank_share,d 

********************************************************************************
reghdfe interest_rate head_male ownhouse bank_share if interest_rate > 0, a(ind year)   
reghdfe pos_bank_debt head_male ownhouse , a(ind year)   
********************************************************************************
